#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>

int IsRotStr(char* str1, char* str2)
{
	int len = strlen(str1);
	if(len != strlen(str2)) return 0;
	for (int i = 0; i < len; i++)
	{
		int start = 0;
		int comp = i;
		while (start < len)
		{
			if (*(str1 + start++) != *(str2 + comp++ % len))
				break;	
		}
		if (start == len)
			return 1;
	}
	return 0;
}

void test()
{
	char str1[] = "AABCD";
	char str2[] = "ABCDA";

	printf("%d\n", IsRotStr(str1, str2));
}
void test2()
{
	char str1[] = "AABCD";
	char str2[] = "ABCDB";

	printf("%d\n", IsRotStr(str1, str2));
}
void test3()
{
	char str1[] = "abcdefg";
	char str2[] = "defgabc";

	printf("%d\n", IsRotStr(str1, str2));
}
void test4()
{
	char str1[] = "abcdefg";
	char str2[] = "defgabd";

	printf("%d\n", IsRotStr(str1, str2));
}
void test5()
{
	char str1[] = "abcde";
	char str2[] = "defgabd";

	printf("%d\n", IsRotStr(str1, str2));
}
int main()
{
	test();
	test2();
	test3();
	test4();
	test5();
	return 0;
}